﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<int>" %>
<%@ Import Namespace="CRM.Models" %>
<%@ Import Namespace="CRM.Resourses" %>

<%
    var requestsCol = new CRM.Database.Model.TrainingsRequestsCollection();
%>

<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdTrainingsRequest";
                                        settings.KeyFieldName = "IdTrainingsRequest";
                                        settings.CallbackRouteValues = new { Controller = "TC", Action = "CustomerTrainingRequestsPartial", customerId = Model };
                                        settings.SettingsPager.PageSize = 20;
                                        
                                        
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            //column.Caption = Resourses.TrainingsRequestNumber;
                                            column.Caption = "№";
                                            column.Width = 10;
                                            column.FieldName = "IdTrainingsRequest";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsRegisterDate;
                                            column.Width = 10;
                                            column.FieldName = "RequestDate";
                                            column.ColumnType = MVCxGridViewColumnType.DateEdit;
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCourseName;
                                            column.Width = 10;
                                            column.FieldName = "CourseNameExt";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCourseDate;
                                            column.Width = 10;
                                            column.FieldName = "CourseDateExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsTrainer;
                                            column.FieldName = "TrainerNameExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCenter;
                                            column.FieldName = "TraningCenterExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Width = 10;
                                            column.Caption = Resourses.TrainingRequestsStatus;
                                            column.FieldName = "StatusExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Width = 10;
                                            column.Caption = Resourses.TrainingsVisit;
                                            column.FieldName = "VisitCoefficientExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Width = 10;
                                            column.Caption = Resourses.TrainingsDuration;
                                            column.FieldName = "DurationExt";
                                        });
                                        
                                        settings.Columns.Add(column =>
                                        {
                                            column.Width = 10;
                                            column.Caption = Resourses.TrainingsCourseCost;
                                            column.FieldName = "CourseCostExt";
                                        });
                                        
                                        settings.Settings.ShowFilterRow = true;
                                    }).Bind(requestsCol.GetTrainingsRequestsByCustomerId(Model)).GetHtml();
                                    //}).Bind(DB.GetTrainingsRequestsByCustomerId(Model)).GetHtml();
%>
